package cn.akwangl.design.pattern.behavioral.state.v1;

/**
 * 上午状态.
 *
 * @author youyongkun
 * @date 2021/12/6 10:34
 */
public class AMState implements State {
    private final String state = HourEnum.ANTE_MERIDIEM.getState();

    @Override
    public void handle(Work work) {
        if (state.equals(HourEnum.hourState(work.getTime()))) {
            System.out.println(String.format("当前时间:%s 上午工作，精神百倍", work.getTime().toString()));
        }else {
            work.setState(new PMState());
        }
    }
}
